package com.example.poc.food;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@DynamicUpdate
@Table(name = "foods")
public class Food implements Serializable {

  private static final long serialVersionUID = -1730538653948604611L;

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;

  @Column(name = "code", nullable = false, length = 25, unique = true)
  private String code;

  @Column(name = "description", nullable = false, length = 250)
  private String description;

  public Food(String code, String description) {
    this.code = code;
    this.description = description;
  }

}
